package com.app.conrtoller;

import com.app.domain.JsonResult;
import com.app.service.QmDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/qm")
public class QmController {
    @Autowired
    private QmDataService qmDataService;
    @RequestMapping("/findAll")
    @ResponseBody
    public JsonResult findAll(String device_code,@RequestParam(name = "page", required = true, defaultValue = "1") Integer page, @RequestParam(name = "limit", required = true, defaultValue = "10") Integer limit) {
        return qmDataService.findAll(device_code,page, limit);
    }

    @RequestMapping("/update")
    @ResponseBody
    public String update(@RequestParam("id") String id, @RequestParam("field") String field, @RequestParam("value") String value) {
        return qmDataService.ConditionUpdate(id, field, value);
    }
}
